#!/bin/sh

# Get the jobid

jobid=$1
workflow=$2
griddir="/biomed/user/d/dttung/panam/outputs"
panamdir="/home/tung/gridpanam"

#lfnfile="biomed-user-d-dttung-panam-outputs-"
#jobstate=`$DIRAC/scripts/dirac-wms-job-status $jobid | cut -d" " -f2 | cut -d"=" -f2 | cut -d";" -f1`

# check jobstate
#if [ "$jobstate" == "Done" ]; then
	# check output directory
	#$DIRAC/scripts/dirac-dms-user-lfns -b "$griddir/$workflow" > tmp$jobid.log
	#rm tmp$jobid.log
	#preprocessfile=`cat "$lfnfile$workflow.lfns" | grep "preprocess"` 
	preprocessfile=`$panamdir/pnls.sh outputs $workflow | grep "preprocess"`
	#rm $lfnfile$workflow.lfns
	if [ "$preprocessfile" == "" ]; then # File is not uploaded
		echo "false";
	else
		echo "true";
	fi
#else
#	echo "false";
#fi
